//
//  LocalInterface.h
//  iHealthEHR
//
//  Created by Joseph Ayo Akinyele on 6/2/10.
//  Copyright 2010 Johns Hopkins University. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <sqlite3.h>
#import "CCRObject.h"

#define LOG_CONSOLE(...)						\
	if (global_error_file != NULL)				\
	( fprintf (global_error_file, __VA_ARGS__), \
	fprintf(global_error_file, " (%s:%d)\n" , __FILE__, __LINE__))


enum DBSTATE { CONNECTED, NOT_CONNECTED };

@interface SqliteInterface : NSObject {
@private
	sqlite3 *dbConnection;
	enum DBSTATE state;
	BOOL recordTableExists;
}

-(id) initWith:(NSString *) username;
-(void) createRecordTable;
-(BOOL) checkID:(NSString *) ID;
-(int) insertCCR:(NSString *) ID inSection:(NSString *) section withXML:(NSXMLElement *) xmlEnc;
-(NSArray *) retrieveCCR:(NSString *) section;
@end
